<!-- tut kalendar-->
<?php
global $conf;
$monthNamesShort=array("Янв", "Фев", "Мар", "Апр", "Май", "Июн", "Июл","Авг","Сен","Окт","Ноя","Дек");
//$dayNamesMin=array( "Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб");
$dayNamesMin=$conf['week_days_short'];
#$dayNamesMin1=array( "Пн", "Вт", "Ср", "Чт", "Пт", "Сб","Вс");
$current_month=date("n");
drupal_add_js("misc/ui/jquery.ui.datepicker.min.js");
?>
<style  type="text/css" scoped="scoped">.ui-datepicker-header{display:none;}</style>

 <script>


 var monthNamesShort=new Array(<?='"'.implode($monthNamesShort,'","').'"'?>);
 var dayNamesMin=new Array(<?='"'.implode($dayNamesMin,'","').'"'?>);
 var active_th=new Array;
 var active_tt=new Array;
 jQuery(function() {
 

jQuery.extend(jQuery.datepicker, {
 
        // Reference the orignal function so we can override it and call it later
        _inlineDatepicker2: jQuery.datepicker._inlineDatepicker,

        // Override the _inlineDatepicker method
        _inlineDatepicker: function (target, inst) {

            // Call the original
            this._inlineDatepicker2(target, inst);

            var beforeShow = jQuery.datepicker._get(inst, 'beforeShow');

            if (beforeShow) {
                beforeShow.apply(target, [target, inst]);
            }
        }
    });
	
jQuery.datepicker._updateDatepicker_original = jQuery.datepicker._updateDatepicker;
	jQuery.datepicker._updateDatepicker = function(inst) {
		jQuery.datepicker._updateDatepicker_original(inst);
		var afterShow = this._get(inst, 'afterShow');
		if (afterShow)
			afterShow.apply((inst.input ? inst.input[0] : null));  // trigger custom callback
	}
	
jQuery( "#datepicker" ).datepicker({
changeMonth: false,
changeYear: false,
onSelect:function(date) {add_date2collector(date);jQuery('.tool_days a').removeClass('active_cal');jQuery('.cal_btn_apply').show();},
afterShow: function(input, inst,td) {set_click4th();},
beforeShowDay:function(date){ return chk_active_day(date);},
firstDay: 1,
"showButtonPanel":false, 
"dayNames":[ "Воскресенье", "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота" ],
 "dayNamesMin": [<?='"'.implode($dayNamesMin,'","').'"'?>],
 "monthNamesShort": [ <?='"'.implode($monthNamesShort,'","').'"'?>],

});

jQuery('#datepicker').prepend('<div class="tool_years"><a class="prev_event_lnk" href="javascript://" onClick="changeYear(<?=date("Y",strtotime("-1 year"));?>)"></a><a href="javascript://" onClick="changeYear(<?=date("Y",strtotime("-1 year"));?>)"><?=date("Y",strtotime("-1 year"));?></a><a  class="active_cal" href="javascript://" onClick="changeYear(<?=date("Y");?>)"><?=date("Y");?></a><a href="javascript://" onClick="changeYear(<?=date("Y",strtotime("+1 year"));?>)"><?=date("Y",strtotime("+1 year"));?></a><a class="next_event_lnk" href="javascript://" onClick="changeYear(<?=date("Y",strtotime("+1 year"));?>)"></a></div>');

jQuery('#datepicker').prepend('<div class="tool_months"><a class="prev_event_lnk" href="javascript://" onclick="changeMonth(<?=((($current_month==1)?date("n",strtotime("-1 month")):($current_month-1))-1);?>)"></a>\n\
<a href="javascript://" onclick="changeMonth(<?=((($current_month==1)?date("n",strtotime("-1 month")):($current_month-1))-1);?>)"><?=$monthNamesShort[(($current_month==1)?date("n",strtotime("-1 month")):($current_month-1))-1];?></a>\n\
<a href="javascript://" onclick="changeMonth(<?=($current_month-1);?>)"  class="active_cal" id="<?=($current_month-1);?>"><?=$monthNamesShort[$current_month-1];?></a>\n\
<a href="javascript://" onclick="changeMonth(<?=(((($current_month+1)>12)?1:($current_month+1))-1);?>)"><?=$monthNamesShort[((($current_month+1)>12)?1:($current_month+1))-1];?></a>\n\
<a class="next_event_lnk" href="javascript://"  onclick="changeMonth(<?=(((($current_month+1)>12)?1:($current_month+1))-1);?>)"></a></div>');

jQuery('#threedays').prepend('<div class="tool_days"><a href="javascript://" onclick="datepicker_set_d(\'<?=date('m/d/Y',strtotime("-1 day"));?>\');">ВЧЕРА</a><a href="javascript://" onclick="datepicker_set_d(\'<?=date('m/d/Y');?>\');">СЕГОДНЯ</a><a href="javascript://" onclick="datepicker_set_d(\'<?=date('m/d/Y',strtotime("+1 day"));?>\');">ЗАВТРА</a></div>');
    
jQuery('.cal_btn_apply').hide();
});

</script>
<?/* onclick="sc_cal();"*/?>
<div id="threedays"></div>
<div class="calendarclose"><span onclick="sc_cal()" class="but_close x"></span> Сегодня <?=date('d');?> <?=$conf['month_names'][date('n')-1];?></div>
<div class="jcalendar">
<div id="datepicker"></div>
<div id="datepicker_collector"></div>
<div class="btn_apply_holder"><span onclick="calendar_events_show()"  class="cal_btn_apply" >ПОКАЗАТЬ</span><span onclick="calendar_events_clear()"  class="cal_btn_clear" >ОЧИСТИТЬ</span></div>

</div>
<a href="/events/engine" class="googlink">События, Инфопарк афиша</a>
<script>jQuery('.googlink').hide();</script>
<!--buba bof-->
<div class="tool_months buba" style="display:none" title="Показать календарь">
    <span class="prev_event_lnk" onclick="chg_buba(<?=(($current_month==1)?date("n",strtotime("-1 month")):($current_month-1))-1;?>,<?=date('Y',strtotime("-1 month"));?>);"></span>
    <span onclick="select_all_tt(<?=(($current_month==1)?date("n",strtotime("-1 month")):($current_month-1))-1;?>,<?=date('Y',strtotime("-1 month"));?>);"><?=$monthNamesShort[(($current_month==1)?date("n",strtotime("-1 month")):($current_month-1))-1];?></span>
    <span class="active_cal" id="middle_tool" onclick="select_all_tt(<?=($current_month-1);?>,<?=date('Y');?>);"><?=$monthNamesShort[($current_month-1)];?></span>
    <span onclick="select_all_tt(<?=((($current_month+1)>12)?1:($current_month+1))-1;?>,<?=date('Y',strtotime("+1 month"));?>);"><?=$monthNamesShort[((($current_month+1)>12)?1:($current_month+1))-1];?></span>
    <span class="next_event_lnk" onclick="chg_buba(<?=((($current_month+1)>12)?1:($current_month+1))-1;?>,<?=date('Y',strtotime("+1 month"));?>);"></span>
</div>
<script>load_first_buba();</script>
<!--buba eof-->